/*
 * @Author: Wangjun
 * @Date: 2021-05-15 22:46:27
 * @LastEditTime: 2021-06-12 18:02:09
 * @LastEditors: Wangjun
 * @Description:
 * @FilePath: \opdb\op.go
 * hnxr
 */
package opdb

import "gorm.io/gorm"

//Max 历史值中取最大值
//只能ID  有值
func (m *Archive) Max(db *gorm.DB, begin, end int64, interval int) (rows []float64, err error) {
	err = db.Model(m).Select("AV").Where("ID=? AND TM between ? AND ? AND mode='max' AND interval='?s'",
		m.ID, begin, end, interval).Find(&rows).Error
	return
}
